//==============================================================================
// PROJECT: ToolsLib
//==============================================================================
// FILE:       perm.cpp
//
// AUTHOR:     Andrey A. Moisseenko
//
//==============================================================================

#include "perm.h"

//#include "temp.h"

#ifdef _WIN32

#ifdef _DEBUG
void* __cdecl operator new(size_t nSize, const char* lpszFileName, int nLine, sDbgTmp *)
{
    return _malloc_dbg(nSize, _NORMAL_BLOCK, lpszFileName, nLine);
}
void* __cdecl operator new[](size_t nSize, const char* lpszFileName, int nLine, sDbgTmp *)
{
    return ::operator new(nSize, lpszFileName, nLine, (sDbgTmp *)nullptr);
}
void __cdecl operator delete(void* pData, const char* /*lpszFileName*/, int /*nLine*/, sDbgTmp *)
{
    _free_dbg(pData, _NORMAL_BLOCK);
}
void __cdecl operator delete[](void* pData, const char* lpszFileName, int nLine, sDbgTmp *)
{
    ::operator delete(pData, lpszFileName, nLine, (sDbgTmp *)nullptr);
}
/*
void* __cdecl operator new(size_t nSize)
{
     //if   (nSize == 12)
     {
          static int aa = 0;
          aa++;
          aa++;
          aa++;
          aa++;
     }
     return _malloc_dbg(nSize, _NORMAL_BLOCK, "unknown", -1);
}
void __cdecl operator delete(void* pData)
{
     _free_dbg(pData, _NORMAL_BLOCK);
}
*/
#endif

//#pragma message( "Compiling " __FILE__ )
//#pragma message( "Last modified on " __TIMESTAMP__ )

#ifdef __TOOLS_USE_WINSOCK2
#pragma message( "Compiling for WinSock 2" )
#else
#pragma message( "Compiling for WinSock 1" )
#endif

#endif

bool gbCMaaPtrThrow = false;

#if 0
struct global__
{
    int aa;
    global__();
    ~global__();
};

global__::global__()
{
    aa = 1;
#ifdef _WIN32
#ifdef _DEBUG
    //_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF);
#endif
#endif
}

global__::~global__()
{
    aa = 0;
}

global__ glb;
#endif


//==============================================================================
